import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Category from '../views/Category.vue'
import Shopcart from '../views/Shopcart.vue'
import User from '../views/User.vue'
import Login from '../views/Login.vue'
import Register from '../views/Register.vue'
import GoodsList from '../views/goods/GoodsList.vue'

Vue.use(VueRouter)

const routes = [{
        path: '/',
        redirect: '/home'
    },
    {
        path: '/home',
        component: Home,
        meta: { title: '首页', re: false }
    },
    {
        path: '/category',
        component: Category,
        meta: { title: '分类', re: true }
    },
	{
        path: '/shopcart',
        component: Shopcart,
        meta: { title: '购物车', re: true }
    },
	{
        path: '/user',
        component: User,
        meta: { title: '我的', re: true }
    },
	{
		path: '/user/login',
		component: Login,
		meta: {title: '登录', re: true}
	},
	{
		path: '/user/register',
		component: Register,
		meta: {title: '注册', re: true}
	},
	{
		path: '/goodslist/:category_id',
		component: GoodsList,
		props: true,
		meta: {title: '商品列表', re: true}
	}
]

const router = new VueRouter({
    routes,
    linkActiveClass: 'mui-active'
})

export default router